package com.qiche.aspect;

import com.qiche.enums.ResultEnum;
import lombok.Data;

/**
 * 分页result返回类
 * @author chendezhi
 * @date 2018/3/21 16:10
 */
@Data
public class PageResult<T>  {
    /**
     * 错误码
     */
    private int code;

    /**
     * 提示信息
     */
    private String msg;

    /**
     * 具体的内容，携带数据实体
     */
    private T data;
    private long total;
    private int nextPage;
    private boolean hasNextPage;

    public PageResult() {
    }

    public PageResult(ResultEnum enums) {
        this.code=enums.getCode();
        this.msg=enums.getMsg();
    }

    public PageResult(ResultEnum enums, T data) {
        this.code=enums.getCode();
        this.msg=enums.getMsg();
        this.data=data;
    }

    public PageResult(Integer code, String msg, T data) {

        this.code=code;
        this.msg=msg;
        this.data=data;
    }

    public PageResult(Integer code, String msg) {
        this.code=code;
        this.msg=msg;
    }
}
